my_dict = {"wjl":100,"hza":100,"wlm":100}

#新增元素
my_dict["zxy"] = 66
print(my_dict)

#更新元素
my_dict["wjl"] = 10
print(my_dict)

#删除元素
score = my_dict.pop("wjl")
print(f"被删除的考试分数为{score},字典为{my_dict}")

#清空元素
my_dict.clear()
print(my_dict)

#获取全部的key
my_dict = {"wjl":100,"hza":100,"wlm":100}
keys = my_dict.keys()
print(keys)

#遍历字典
#方式一通过获取key来遍历
for key in keys:
    print(f"{key} ",end = "")
    print(my_dict[key])

#方式2通过字典直接遍历
for key in my_dict:
    print(f"{key} ",end = "")
    print(my_dict[key])

#统计字典内的元素数量
num = len(my_dict)
print(num)
